package com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance;

import com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance.dto.BusinessApprovalInstanceListCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance.param.BusinessApprovalInstanceApprovalCloudParam;
import com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance.param.BusinessApprovalInstanceCreateCloudParam;
import com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance.param.BusinessApprovalInstanceListCloudParam;
import com.youkeyi.ddy.cloud.common.response.ResponseContent;
import io.swagger.annotations.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 人事审批
 *
 * @author  liuxiawang
 * @Date 5/24/22 10:36 PM
 * @Location shenzhen.china
 */
@Api(tags = {"【BUSINESS】Approval Instance Management"})
@RestController
@FeignClient(value = "YOUKEYI-DDY-CLOUD-APPLICATION-BUSINESS", fallback = BusinessApprovalInstanceCloudServiceFallback.class)
@RequestMapping("/business/approval")
public interface BusinessApprovalInstanceCloudService {

    // 查询人事审批列表
    @ApiOperation(value = "Query Approval Instance List", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance.BusinessApprovalInstanceCloudService.instanceList")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = BusinessApprovalInstanceListCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Query Approval Instance List", dataType = "BusinessApprovalInstanceListCloudParam", dataTypeClass = BusinessApprovalInstanceListCloudParam.class),
    })
    @GetMapping("/instance")
    public abstract BusinessApprovalInstanceListCloudDto instanceList(BusinessApprovalInstanceListCloudParam param);

    // 创建人事审批
    @ApiOperation(value = "Create Approval Instance", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance.BusinessApprovalInstanceCloudService.instanceCreate")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Create Approval Instance", dataType = "BusinessApprovalInstanceCreateCloudParam", dataTypeClass = BusinessApprovalInstanceCreateCloudParam.class),
    })
    @PostMapping("/instance")
    public abstract ResponseContent instanceCreate(@RequestBody BusinessApprovalInstanceCreateCloudParam param);


    // 审批
    @ApiOperation(value = "Process Approval", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance.BusinessApprovalInstanceCloudService.approval")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Process Approval", dataType = "BusinessApprovalInstanceApprovalCloudParam", dataTypeClass = BusinessApprovalInstanceApprovalCloudParam.class),
    })
    @PostMapping("/approval")
    public abstract ResponseContent approval(@RequestBody BusinessApprovalInstanceApprovalCloudParam param);

    // 撤销
    @ApiOperation(value = "Process Revoke", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.hr.approval.instance.BusinessApprovalInstanceCloudService.revoke")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Process Revoke", dataType = "BusinessApprovalInstanceApprovalCloudParam", dataTypeClass = BusinessApprovalInstanceApprovalCloudParam.class),
    })
    @PostMapping("/approval/revoke")
    public abstract ResponseContent revoke(@RequestBody BusinessApprovalInstanceApprovalCloudParam param);
}
